home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 15 / Amiga Plus Leser CD 15.iso / Tools / Freeware / PerfectPaint / rexx / text / Motion_ToolKit.rx < prev    next >
Encoding:
Text File  |  2002-03-13  |  6.4 KB  |  403 lines

  1. /*
  2.     Arexx Text Script
  3. */
  4.  
  5.     call addlib("rexxmathlib.library", 5, -30, 0)
  6.  
  7.     options results
  8.   parse ARG Port x y b
  9.     ADDRESS value Port
  10.  
  11.     pp_AvoidRefresh
  12.  
  13.     pp_GetDepth
  14.     Dp=result
  15.  
  16.     ADDRESS COMMAND
  17.  
  18.     file="T:pp_text"
  19.     IF OPEN('a',file,'R') then DO
  20.         trash=READLN('a')
  21.         trash=READLN('a')
  22.         Tsize=READLN('a')
  23.         Ttype=READLN('a')
  24.         trash=READLN('a')
  25.         trash=READLN('a')
  26.         trash=READLN('a')
  27.         trash=READLN('a')
  28.         Txdpi=READLN('a')
  29.         Tydpi=READLN('a')
  30.         Trot=READLN('a')
  31.         Tita=READLN('a')
  32.         trash=READLN('a')
  33.         trash=READLN('a')
  34.         trash=READLN('a')
  35.         trash=READLN('a')
  36.         trash=READLN('a')
  37.         trash=READLN('a')
  38.         Tw=READLN('a')
  39.         Th=READLN('a')
  40.         CALL CLOSE('a')
  41.  
  42.         Start_Rotation=Trot
  43.         End_Rotation=Trot
  44.  
  45.         Start_Italic=Tita
  46.         End_Italic=Tita
  47.  
  48.         Start_Size=Tsize
  49.         End_Size=Tsize
  50.  
  51.         Start_Xdpi=Txdpi
  52.         End_Xdpi=Txdpi
  53.  
  54.         Start_Ydpi=Tydpi
  55.         End_Ydpi=Tydpi
  56.  
  57.         OS=0
  58.  
  59.         Start_Frame=1
  60.         End_Frame=10
  61.  
  62.     END
  63.     ELSE
  64.     DO
  65.         ADDRESS value Port
  66.         pp_Warn 'Make*a*Text*first.'
  67.         pp_PermitRefresh
  68.         EXIT
  69.         ADDRESS COMMAND        
  70.     END
  71.  
  72.     file="T:pp_blur"
  73.     IF OPEN('b',file,'R') then DO
  74.         Start_Rotation=READLN('b')
  75.         End_Rotation=READLN('b')
  76.  
  77.         Start_Italic=READLN('b')
  78.         End_Italic=READLN('b')
  79.  
  80.         Start_Size=READLN('b')
  81.         End_Size=READLN('b')
  82.  
  83.         Start_Xdpi=READLN('b')
  84.         End_Xdpi=READLN('b')
  85.  
  86.         Start_Ydpi=READLN('b')
  87.         End_Ydpi=READLN('b')
  88.  
  89.         OS=READLN('b')
  90.         End_Frame=READLN('b')        
  91.  
  92.         CALL CLOSE('b')
  93.     END
  94.  
  95.     R=-1
  96.  
  97.     ADDRESS value Port
  98.  
  99.     Path=0;Type=0
  100.  
  101.  
  102. DO UNTIL R>-1
  103.  
  104.     D.4='*Rotation*(*'||Start_Rotation||'*->*'||End_Rotation||'*)*'
  105.     D.5='*Italic*(*'||Start_Italic||'*->*'||End_Italic||'*)*'
  106.     D.6='*Size*(*'||Start_Size||'*->*'||End_Size||'*)*'
  107.     D.7='*ScaleX*(*'||Start_Xdpi||'*->*'||End_Xdpi||'*)*'
  108.     D.8='*ScaleY*(*'||Start_Ydpi||'*->*'||End_Ydpi||'*)*'
  109.     pp_DialogInit 250 240 "*BLUR*" 9
  110.     pp_Cycle 0 70 5 100 16 "Path" 1 "None|Left|Right|Up|Down" Path
  111.     pp_Cycle 1 70 25 100 16 "Type" 1 "In|Out" Type
  112.     pp_Cycle 2 70 45 100 16 "Mode" 1 "Opacity|Spray" OS
  113.     pp_Integer 3 70 75 50 16 "Amount" 1 End_Frame
  114.     pp_
  115.         j=105
  116.         DO i=4 to 8
  117.             pp_Button i 20 j 200 16 D.i
  118.             j=j+20
  119.         END
  120.     pp_Dialog
  121.     R=result
  122.  
  123.     pp_GetDialog 0
  124.     Path=result
  125.  
  126.     pp_GetDialog 1
  127.     Type=result
  128.  
  129.     pp_GetDialog 2
  130.     OS=result
  131.  
  132.     pp_GetDialog 3
  133.     End_Frame=result    
  134.  
  135.     if R=-6 then DO
  136.         pp_DialogInit 150 80 "*SIZE*" 2
  137.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Size
  138.             pp_Integer 1 60 25 50 16 "End" 1 End_Size
  139.         pp_Dialog
  140.         rc=result
  141.         IF rc=1 then DO
  142.             pp_GetDialog 0
  143.             Start_Size=result
  144.  
  145.             pp_GetDialog 1
  146.             End_Size=result        
  147.         END            
  148.     END
  149.  
  150.     if R=-7 then DO
  151.         pp_DialogInit 150 80 "*SCALE*X*" 2
  152.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Xdpi
  153.             pp_Integer 1 60 25 50 16 "End" 1 End_Xdpi
  154.         pp_Dialog
  155.         rc=result
  156.         IF rc=1 then DO
  157.             pp_GetDialog 0
  158.             Start_Xdpi=result
  159.  
  160.             pp_GetDialog 1
  161.             End_Xdpi=result        
  162.         END            
  163.     END
  164.  
  165.     if R=-8 then DO
  166.         pp_DialogInit 150 80 "*SCALE*Y*" 2
  167.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Ydpi
  168.             pp_Integer 1 60 25 50 16 "End" 1 End_Ydpi
  169.         pp_Dialog
  170.         rc=result
  171.         IF rc=1 then DO
  172.             pp_GetDialog 0
  173.             Start_Ydpi=result
  174.  
  175.             pp_GetDialog 1
  176.             End_Ydpi=result        
  177.         END            
  178.     END
  179.  
  180.     if R=-4 then DO
  181.         pp_DialogInit 150 80 "*ROTATION*" 2
  182.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Rotation
  183.             pp_Integer 1 60 25 50 16 "End" 1 End_Rotation
  184.         pp_Dialog
  185.         rc=result
  186.         IF rc=1 then DO
  187.             pp_GetDialog 0
  188.             Start_Rotation=result
  189.  
  190.             pp_GetDialog 1
  191.             End_Rotation=result        
  192.         END            
  193.     END
  194.  
  195.     if R=-5 then DO
  196.         pp_DialogInit 150 80 "*ITALIC*" 2
  197.             pp_Integer 0 60 5 50 16 "Start" 1 Start_Italic
  198.             pp_Integer 1 60 25 50 16 "End" 1 End_Italic
  199.         pp_Dialog
  200.         rc=result
  201.         IF rc=1 then DO
  202.             pp_GetDialog 0
  203.             Start_Italic=result
  204.             IF Start_Italic>45 then DO
  205.                 Start_Italic=45
  206.             END
  207.             IF Start_Italic<-45 then DO
  208.                 Start_Italic=-45
  209.             END
  210.  
  211.             pp_GetDialog 1
  212.             End_Italic=result    
  213.             IF End_Italic>45 then DO
  214.                 End_Italic=45
  215.             END
  216.             IF End_Italic<-45 then DO
  217.                 End_Italic=-45
  218.             END
  219.  
  220.         END            
  221.     END
  222. END
  223.  
  224.     if R=0 then DO
  225.         pp_PermitRefresh
  226.         EXIT
  227.     END    
  228.     
  229.     ADDRESS COMMAND
  230.  
  231.     file='t:pp_blur'
  232.  
  233.     IF EXISTS(file) THEN DO
  234.         'delete >nil: t:pp_move'
  235.     END
  236.  
  237.     IF OPEN('c',file,'W') then DO
  238.  
  239.         CALL WRITELN('c',Start_Rotation)
  240.         CALL WRITELN('c',End_Rotation)
  241.  
  242.         CALL WRITELN('c',Start_Italic)
  243.         CALL WRITELN('c',End_Italic)
  244.  
  245.         CALL WRITELN('c',Start_Size)
  246.         CALL WRITELN('c',End_Size)
  247.  
  248.         CALL WRITELN('c',Start_Xdpi)
  249.         CALL WRITELN('c',End_Xdpi)
  250.  
  251.         CALL WRITELN('c',Start_Ydpi)
  252.         CALL WRITELN('c',End_Ydpi)
  253.  
  254.         CALL WRITELN('c',OS)
  255.         CALL WRITELN('c',End_Frame)
  256.  
  257.         CALL CLOSE('c')
  258.     END
  259.  
  260.     ADDRESS value Port
  261.     pp_UpdateUndo
  262.  
  263.     pp_GetWidth
  264.     W=result
  265.  
  266.     pp_GetHeight
  267.     H=result
  268.  
  269.     HX=Tw/2
  270.     HY=Th/2
  271.  
  272.     Start_X=x
  273.     End_X=x
  274.     Start_Y=y
  275.     End_Y=y
  276.  
  277.     IF Path=1 then DO
  278.         IF Type=0 then DO
  279.             Start_X=HX*-1
  280.         END
  281.         ELSE
  282.         DO
  283.             End_X=HX*-1
  284.         END
  285.     END
  286.  
  287.     IF Path=2 then DO
  288.         IF Type=0 then DO
  289.             Start_X=W+HX
  290.         END
  291.         ELSE
  292.         DO
  293.             End_X=W+HX
  294.         END
  295.     END
  296.  
  297.     IF Path=3 then DO
  298.         IF Type=0 then DO
  299.             Start_Y=HY*-1
  300.         END
  301.         ELSE
  302.         DO
  303.             End_Y=HY*-1
  304.         END
  305.     END
  306.  
  307.     IF Path=4 then DO
  308.         IF Type=0 then DO
  309.             Start_Y=H+HY
  310.         END
  311.         ELSE
  312.         DO
  313.             End_Y=H+HY
  314.         END
  315.     END
  316.  
  317.     step=(End_Frame-Start_Frame)
  318.  
  319.     Step_Rotation=(End_Rotation-Start_Rotation)/Step
  320.     Step_Italic=(End_Italic-Start_Italic)/Step
  321.     Step_Xdpi=(End_Xdpi-Start_Xdpi)/Step
  322.     Step_Ydpi=(End_Ydpi-Start_Ydpi)/Step
  323.     Step_Size=(End_Size-Start_Size)/Step
  324.  
  325.     Step_X=(End_X-Start_X)/Step
  326.     Step_Y=(End_Y-Start_Y)/Step
  327.  
  328.     Opacity=6
  329.     Flow=5
  330.  
  331.     DO i=1 to End_Frame
  332.  
  333.         Rotation=trunc(Start_Rotation+Step_Rotation*(i-Start_Frame)+0.5,0)
  334.         Italic=trunc(Start_Italic+Step_Italic*(i-Start_Frame)+0.5,0)
  335.         Xdpi=trunc(Start_Xdpi+Step_Xdpi*(i-Start_Frame)+0.5,0)
  336.         Ydpi=trunc(Start_Ydpi+Step_Ydpi*(i-Start_Frame)+0.5,0)
  337.         Size=trunc(Start_Size+Step_Size*(i-Start_Frame)+0.5,0)
  338.         X=trunc(Start_X+Step_X*(i-Start_Frame)+0.5,0)
  339.         Y=trunc(Start_Y+Step_Y*(i-Start_Frame)+0.5,0)
  340.  
  341.     IF OS=1 then DO        
  342.         pp_EffectOn
  343.         pp_AirBrush Opacity Flow
  344.     END
  345.     ELSE DO
  346.         IF Dp=24 then DO
  347.             pp_BrushOpacity Opacity
  348.         END
  349.         ELSE DO
  350.             pp_EffectOn
  351.             pp_Trans Opacity
  352.         END
  353.     END
  354.  
  355.     IF OXdpi=Xdpi&OYdpi=Ydpi&OItalic=Italic&ORotation=Rotation&OSize=Size then DO
  356.         pp_TextDraw X Y
  357.     END
  358.     ELSE DO
  359.         IF Opacity>0 then DO
  360.             pp_TextXDPI Xdpi
  361.             pp_TextYDPI Ydpi
  362.             pp_TextItalic Italic
  363.             pp_TextRotate Rotation
  364.             pp_TextSize Size
  365.             pp_TextMake
  366.             pp_TextDraw X Y
  367. /*
  368.             do ii=1 to 10
  369.                 pp_NextFrame
  370.                 pp_TextDraw X Y
  371.             end
  372.             do ii=1 to 9
  373.                 pp_PreviousFrame
  374.             end
  375. */
  376.             OXdpi=Xdpi
  377.             OYdpi=Ydpi            
  378.             OItalic=Italic
  379.             ORotation=Rotation
  380.             OSize=Size
  381.  
  382.         END
  383.     END
  384.  
  385.         pp_EffectOff
  386.  
  387.     END
  388.  
  389.             IF Dp=24 then DO
  390.                 pp_BrushOpacity 100
  391.             END
  392.             ELSE DO
  393.                 pp_EffectOn
  394.                 pp_Trans 100
  395.             END
  396.  
  397.     pp_TextDraw X Y
  398.     pp_EffectOff
  399.     
  400.     pp_TextRestore
  401.     pp_TextMake
  402.     pp_PermitRefresh
  403.